<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增菜品管理')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-cpgl-add">
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">商品名称：</label>
                <div class="col-sm-8">
                    <input name="goodsName" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">商品图片：</label>
                <div class="fileinput-button col-sm-8">
                    <input type="hidden" class="file-upload-url" name="imgId"/>
                    <img  style="width: 120px; height: 120px; position: absolute; z-index: 3;background-color: lightgray" class="file-upload-img">
                    <input type="file" style="" class="file-upload" accept="image/*"/>
                </div>

            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">商品分类id：</label>
                <div class="col-sm-8">
                    <input name="categoryId" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">商品规格(1单规格 2多规格)：</label>
                <div class="col-sm-8">
                    <select name="specType" class="form-control m-b" th:with="type=${@dict.getType('spec_type')}" required>
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">库存计算方式(1下单减库存 2付款减库存)：</label>
                <div class="col-sm-8">
                    <select name="deductStockType" class="form-control m-b" th:with="type=${@dict.getType('deduct_stock_type')}" required>
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">商品详情：</label>
                <div class="col-sm-8">
                    <input name="content" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">初始销量：</label>
                <div class="col-sm-8">
                    <input name="salesInitial" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">实际销量：</label>
                <div class="col-sm-8">
                    <input name="salesActual" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">商品排序(数字越小越靠前)：</label>
                <div class="col-sm-8">
                    <input name="goodsSort" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">商品状态(1上架 2下架)：</label>
                <div class="col-sm-8">
                    <div class="radio-box" th:each="dict : ${@dict.getType('goods_status')}">
                        <input type="radio" th:id="${'goodsStatus_' + dict.dictCode}" name="goodsStatus" th:value="${dict.dictValue}" th:checked="${dict.default}" required>
                        <label th:for="${'goodsStatus_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">餐盒费用：</label>
                <div class="col-sm-8">
                    <input name="packPrice" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">是否删除：</label>
                <div class="col-sm-8">
                    <input name="isDelete" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">门店id：</label>
                <div class="col-sm-8">
                    <input name="shopId" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">小程序id：</label>
                <div class="col-sm-8">
                    <input name="wxappId" class="form-control" type="text" required>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var prefix = ctx + "smdd/cpgl"
        $("#form-cpgl-add").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/add", $('#form-cpgl-add').serialize());
            }
        }
    </script>
</body>
</html>